// SimNet is a Second Life(tm) sim mangement tool that was designed for Fermi Sandbox
// Copyright (C) 2011 Arthur Fermi
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To receive a copy of this license please visit http://www.gnu.org/licenses/

// SimNet - Performance Monitor

// Global Variables
float   gfltTimer;          // How often to refresh the info

default
{
    state_entry()
    {
        llSetTimerEvent(0.2);
        llSetText("", <1,1,1>, 1);
    }

    timer()
    {
        vector  vecPos = llGetPos();                                // Current Position
        string  strSimName = llGetRegionName();                     // Sim Name
        list    lstParcelName = [PARCEL_DETAILS_NAME];              // Set list for Parcel
        string  strParcelName = (string)llGetParcelDetails(vecPos,lstParcelName);  // Parcel Name
        float   fltSimFPS = llGetRegionFPS();                       // Sim FPS
        float   fltSimDilation = llGetRegionTimeDilation();        // Sim Time Dialation
            
         // Set Hover Text
         llMessageLinked(-2, 99, strSimName + "\n" + strParcelName + "\nPosition: X: " + (string)llRound(vecPos.x) + "  Y: " + (string)llRound(vecPos.y) + "  Z: " + (string)llRound(vecPos.z) + "\n FPS: " + (string)llFloor(fltSimFPS) + "\n Time Dilation: " + (string)fltSimDilation, "");
    }
    
    on_rez(integer start_param)
    {
        llSetScriptState(llGetScriptName(), FALSE);
        llResetScript();    
    }
}